package com.example.pageability.slice;

import com.example.pageability.ResourceTable;
import ohos.aafwk.ability.AbilitySlice;
import ohos.aafwk.content.Intent;
import ohos.agp.components.Component;
import ohos.agp.components.Text;

public class DetailAbilitySlice extends AbilitySlice {
    String title = "";

    @Override
    protected void onStart(Intent intent) {
        super.onStart(intent);
        super.setUIContent(ResourceTable.Layout_ability_detail);
        this.title = intent.getStringParam("title");
        Text text = (Text) findComponentById(ResourceTable.Id_detail_text);
        text.setText(title);

        text.setClickedListener(new Component.ClickedListener() {
            @Override
            public void onClick(Component component) {
                Intent i = new Intent();
                i.setParam("data", "反向传值的数据");
                setResult(i);
                terminate();
            }
        });
    }
}
